<!--
 * @Author: your name
 * @Date: 2021-09-13 21:22:31
 * @LastEditTime: 2021-09-13 21:28:16
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\Web课后练习成果\ES5\复习01\DOM操作\操作元素.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>显示当前时间为</button>
    <div>时间</div>
</body>
<script>
    var btn = document.getElementsByTagName('button')[0];
    var div = document.getElementsByTagName('div')[0];
    btn.onclick = function() {
        //修改元素的内容
        div.innerText = "2021 - 9 - 13";
    }
</script>

</html>